﻿namespace QLPhongKham.UC
{
    using DevExpress.Data;
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Mask;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Base;
    using DevExpress.XtraGrid.Views.Grid;
    using DevExpress.XtraTab;
    using QLPhongKham.Access;
    using QLPhongKham.Access.Duoc;
    using QLPhongKham.BaseClass.Duoc;
    using QLPhongKham.Report;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;
    using UserControls;

    public class ucd_phieudathang : XtraUserControl
    {
        private long _iDPhieuDatHang;
        private int _iiddangnhap;
        private DPhieuDatHang _phieudathang;
        private General _xuli;
        private SimpleButton btnboqua;
        private SimpleButton btnhuy;
        private SimpleButton btnin;
        private SimpleButton btnketthuc;
        private SimpleButton btnluu;
        private SimpleButton btnmoi;
        private SimpleButton btnsua;
        private SimpleButton btnthem;
        private SimpleButton btnthemduocpham;
        private SimpleButton btntim;
        private SimpleButton btnxoa;
        private LookUpEdit cbbdonggoi;
        private IContainer components;
        private ctrdanhsach ctrdanhsach_nhacc;
        private ctrdanhsach ctrdanhsach_vp;
        private DateEdit datedenngay;
        private DateEdit datengay;
        private DateEdit datengaygiao;
        private DateEdit datetungay;
        private GridControl gridds;
        private GridColumn gridds_dongia;
        private GridColumn gridds_dvt;
        private GridColumn gridds_hangsx;
        private GridColumn gridds_id;
        private GridColumn gridds_idphieuct;
        private GridColumn gridds_idquydoi;
        private GridColumn gridds_ma;
        private GridColumn gridds_slxuat;
        private GridColumn gridds_soluong;
        private GridColumn gridds_soluongtong;
        private GridColumn gridds_ten;
        private GridColumn gridds_tenhoatchat;
        private GridColumn gridds_thanhtien;
        private GridControl gridsp;
        private GridColumn gridsp_id;
        private GridColumn gridsp_ngay;
        private GridColumn gridsp_sophieu;
        private GridView gridView1;
        private GridView gridView2;
        private GroupControl groupControl1;
        private Label label1;
        private Label label10;
        private Label label11;
        private Label label14;
        private Label label16;
        private Label label18;
        private Label label2;
        private Label label25;
        private Label label26;
        private Label label27;
        private Label label29;
        private Label label3;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label label7;
        private Label label8;
        private Label label9;
        private Label lblmaso;
        private RepositoryItemTextEdit repositoryItemTextEdit1;
        private RepositoryItemTextEdit repositoryItemTextEdit2;
        private RepositoryItemTextEdit repositoryItemTextEdit3;
        private RepositoryItemTextEdit repositoryItemTextEdit4;
        private UCTextBoxNumeric tbnumdongia;
        private UCTextBoxNumeric tbnumsoluong;
        private UCTextBoxNumeric tbnumsoluong1;
        private TextEdit txtdiachi;
        private TextEdit txtdienthoai;
        private TextEdit txtdvt;
        private TextEdit txtghichu;
        private TextEdit txthangsx;
        private TextEdit txtma;
        private TextEdit txtnguoidaidien;
        private TextEdit txtnhaccma;
        private TextEdit txtnhaccten;
        private TextEdit txtptgiaohang;
        private TextEdit txtptthanhtoan;
        private TextEdit txtsophieu;
        private TextEdit txtten;
        private TextEdit txttenhoatchat;

        public ucd_phieudathang()
        {
            this._iDPhieuDatHang = 0L;
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = new General();
        }

        public ucd_phieudathang(int iddangnhap)
        {
            this._iDPhieuDatHang = 0L;
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = new General();
            this._iiddangnhap = iddangnhap;
        }

        public ucd_phieudathang(General xuli, int iddangnhap)
        {
            this._iDPhieuDatHang = 0L;
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = xuli;
            this._iiddangnhap = iddangnhap;
        }

        public ucd_phieudathang(General xuli, long iDPhieuDatHang, int iddangnhap)
        {
            this._iDPhieuDatHang = 0L;
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = xuli;
            this._iDPhieuDatHang = iDPhieuDatHang;
            this._iiddangnhap = iddangnhap;
        }

        private void btnboqua_Click(object sender, EventArgs e)
        {
            this.f_Control_enable(false);
        }

        private void btnhuy_Click(object sender, EventArgs e)
        {
            try
            {
                ((DataTable) this.gridds.DataSource).AcceptChanges();
                if (MessageBox.Show("Bạn chắc chắn muốn hủy phiếu đặt h\x00e0ng n\x00e0y?", "Th\x00f4ng b\x00e1o", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.No)
                {
                    if (!this._phieudathang.f_huyphieunhap(long.Parse(this.txtsophieu.Tag.ToString())))
                    {
                        MessageBox.Show("Hủy phiếu kh\x00f4ng th\x00e0nh c\x00f4ng.\nVui l\x00f2ng kiểm tra lại.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    else
                    {
                        MessageBox.Show("Đ\x00e3 hủy phiếu th\x00e0nh c\x00f4ng.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.btnmoi_Click_1(null, null);
                        this.btnboqua_Click(null, null);
                        this.btntim_Click(null, null);
                    }
                }
            }
            catch
            {
            }
        }

        private void btnin_Click(object sender, EventArgs e)
        {
            DataTable table = this._phieudathang.f_loaddata_dathang(long.Parse(this.txtsophieu.Tag.ToString()), "", "");
            table.TableName = "sophieu";
            DataTable table2 = this._phieudathang.f_loaddata_dathangct(long.Parse(this.txtsophieu.Tag.ToString()));
            table2.TableName = "chitiet";
            table2.Columns.Add("sophieu");
            table2.Columns.Add("ngaydathang");
            table2.Columns.Add("ngaydukiengiaohang");
            table2.Columns.Add("nguoigiao");
            table2.Columns.Add("tennhacc");
            table2.Columns.Add("diachi");
            table2.Columns.Add("dienthoai");
            table2.Columns.Add("ptthanhtoan");
            table2.Columns.Add("ptgiaohang");
            table2.Columns.Add("dieukienkhac");
            for (int i = 0; i < table2.Rows.Count; i++)
            {
                table2.Rows[i]["sophieu"] = table.Rows[0]["sophieu"].ToString();
                table2.Rows[i]["ngaydathang"] = table.Rows[0]["ngay"].ToString();
                table2.Rows[i]["ngaydukiengiaohang"] = table.Rows[0]["ngaygiao"].ToString();
                table2.Rows[i]["nguoigiao"] = table.Rows[0]["nguoidaidien"].ToString();
                table2.Rows[i]["tennhacc"] = table.Rows[0]["tennhacc"].ToString();
                table2.Rows[i]["diachi"] = table.Rows[0]["diachi"].ToString();
                table2.Rows[i]["dienthoai"] = table.Rows[0]["dienthoai"].ToString();
                table2.Rows[i]["ptthanhtoan"] = table.Rows[0]["ptthanhtoan"].ToString();
                table2.Rows[i]["ptgiaohang"] = table.Rows[0]["ptgiaohang"].ToString();
                table2.Rows[i]["dieukienkhac"] = table.Rows[0]["ghichu"].ToString();
            }
            DataSet data = new DataSet();
            data.Tables.Add(table2.Copy());
            data.WriteXml("dataxml//d_inphieudathang.xml", XmlWriteMode.WriteSchema);
            new XtraReport1().f_load(data, "d_in_phieudathang.repx");
        }

        private void btnketthuc_Click(object sender, EventArgs e)
        {
            try
            {
                XtraTabPage parent = (XtraTabPage) base.Parent;
                XtraTabControl control = (XtraTabControl) parent.Parent;
                control.TabPages.Remove(parent);
            }
            catch
            {
                XtraUserControl control2 = (XtraUserControl) base.Parent;
                control2.Controls.Remove(this);
            }
        }

        private void btnluu_Click(object sender, EventArgs e)
        {
            dtoDPhieuDatHangCT gct = new dtoDPhieuDatHangCT(this._xuli.pConFigData);
            DataTable dataSource = (DataTable) this.gridds.DataSource;
            dataSource.AcceptChanges();
            dtoDPhieuDatHangCT[] chitiet = new dtoDPhieuDatHangCT[dataSource.Rows.Count];
            for (int i = 0; i < dataSource.Rows.Count; i++)
            {
                gct = new dtoDPhieuDatHangCT(this._xuli.pConFigData) {
                    pIDDANGNHAP = this._iiddangnhap,
                    pDONGIA = decimal.Parse(dataSource.Rows[i][this.gridds_dongia.FieldName].ToString()),
                    pSOLUONG = decimal.Parse(dataSource.Rows[i][this.gridds_soluong.FieldName].ToString()),
                    pHANGSX = dataSource.Rows[i][this.gridds_hangsx.FieldName].ToString(),
                    pIDDUOCPHAM = int.Parse(dataSource.Rows[i][this.gridds_id.FieldName].ToString()),
                    pIDPHIEU = long.Parse(this.txtsophieu.Tag.ToString())
                };
                try
                {
                    gct.pSOLUONGTONG = decimal.Parse(dataSource.Rows[i][this.gridds_soluongtong.FieldName].ToString());
                }
                catch
                {
                    gct.pSOLUONGTONG = 0M;
                }
                try
                {
                    gct.pIDQUYDOI = int.Parse(this.cbbdonggoi.EditValue.ToString());
                }
                catch
                {
                    gct.pIDQUYDOI = 0;
                }
                gct.pTENMAYTINH = Environment.MachineName;
                chitiet[i] = gct;
            }
            dtoDPhieuDatHang dathang = new dtoDPhieuDatHang(this._xuli.pConFigData) {
                pID = long.Parse(this.txtsophieu.Tag.ToString()),
                pIDDANGNHAP = this._iiddangnhap,
                pIDNHACUNGCAP = int.Parse(this.txtnhaccma.Tag.ToString()),
                pNGAY = this.datengay.Text,
                pTENMAYTINH = Environment.MachineName,
                pNGAYGIAO = this.datengaygiao.Text
            };
            try
            {
                dathang.pSOPHIEU = int.Parse(this.txtsophieu.Text);
            }
            catch
            {
            }
            dathang.pGHICHU = this.txtghichu.Text;
            dathang.pPHUONGTHUCGIAOHANG = this.txtptgiaohang.Text;
            dathang.pPHUONGTHUCTHANHTOAN = this.txtptthanhtoan.Text;
            DPhieuDatHang hang2 = new DPhieuDatHang(this._xuli.pConFigData);
            if (dathang.pID == 0L)
            {
                dathang.pSOPHIEU = Convert.ToInt32(hang2.f_get_capsophieu());
                this.txtsophieu.Tag = hang2.f_insert_phieudathang(dathang, chitiet).ToString();
                if (this.txtsophieu.Tag.ToString() == "0")
                {
                    MessageBox.Show("Kh\x00f4ng lưu được th\x00f4ng tin phiếu đặt h\x00e0ng.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return;
                }
            }
            else
            {
                this.txtsophieu.Tag = hang2.f_update_dathang(dathang, chitiet).ToString();
                if (this.txtsophieu.Tag.ToString() == "0")
                {
                    MessageBox.Show("Kh\x00f4ng lưu được th\x00f4ng tin phiếu đặt h\x00e0ng.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return;
                }
            }
            this.f_setcontrol_phieudathang(long.Parse(this.txtsophieu.Tag.ToString()));
            this.f_loaddata_phieudathangct(long.Parse(this.txtsophieu.Tag.ToString()));
            this.btntim_Click(null, null);
            this.f_Control_enable(false);
        }

        private void btnmoi_Click(object sender, EventArgs e)
        {
            this.f_Add_ChiTiet();
            this.f_Loadcontrol_dmvp(0L, "", "", "", "", "");
            this.f_Loadcontrol_dathangchitiet(0L, 0M, 0M, 0M, 0, "");
            base.ActiveControl = this.txtma;
        }

        private void btnmoi_Click_1(object sender, EventArgs e)
        {
            this.f_Control_enable(true);
            this.datengay.EditValue = DateTime.Now;
            this.datengaygiao.EditValue = DateTime.Now;
            this.f_Loadcontrol_dathang(0L, "", DateTime.Now.ToString("dd/MM/yyyy HH:mm"), DateTime.Now.ToString("dd/MM/yyyy HH:mm"), 0, "", "", "");
            this.f_loaddata_phieudathangct(0L);
            this.f_loadinfo_chidinhchitiet(0);
            base.ActiveControl = this.datengay;
        }

        private void btnsua_Click(object sender, EventArgs e)
        {
            try
            {
                this.f_Control_enable(true);
                this.txtten.Focus();
            }
            catch
            {
            }
        }

        private void btnthemduocpham_Click(object sender, EventArgs e)
        {
            ucd_dmduocpham _dmduocpham = new ucd_dmduocpham();
            base.Controls.Add(_dmduocpham);
            _dmduocpham.Location = new Point(0, 0);
            _dmduocpham.Width = base.Width;
            _dmduocpham.Height = base.Height;
            _dmduocpham.Show();
            _dmduocpham.BringToFront();
        }

        private void btntim_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable table = this._phieudathang.f_loaddata_dathang(0L, this.datetungay.Text, this.datedenngay.Text);
                this.gridsp.DataSource = table;
            }
            catch
            {
            }
        }

        private void btnxoa_Click(object sender, EventArgs e)
        {
            if (this.txtma.Tag.ToString() != "0")
            {
                try
                {
                    this.gridView1.DeleteSelectedRows();
                }
                catch
                {
                }
            }
        }

        private void cbbdonggoi_EditValueChanged(object sender, EventArgs e)
        {
            this.tbnumsoluong1_Validated(sender, e);
        }

        private void ctrdanhsach_nhacc_Validated(object sender, EventArgs e)
        {
            try
            {
                DataTable dongHienTai = this.ctrdanhsach_nhacc.DongHienTai;
                this.f_SetControl_dmnhacc(long.Parse(dongHienTai.Rows[0]["id"].ToString()));
            }
            catch
            {
            }
        }

        private void ctrdanhsach_vp_Validated(object sender, EventArgs e)
        {
            try
            {
                DataTable dongHienTai = this.ctrdanhsach_vp.DongHienTai;
                this.f_SetControl_dmsanpham(long.Parse(dongHienTai.Rows[0]["id"].ToString()));
            }
            catch
            {
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void f_Add_ChiTiet()
        {
            if ((this.txtma.Tag != null) && (this.txtma.Tag.ToString() != "0"))
            {
                DataTable dataSource = (DataTable) this.gridds.DataSource;
                DataRow row = dataSource.NewRow();
                row[this.gridds_ma.FieldName] = this.txtma.Text;
                row[this.gridds_ten.FieldName] = this.txtten.Text;
                row[this.gridds_dvt.FieldName] = this.txtdvt.Text;
                row[this.gridds_id.FieldName] = this.txtma.Tag.ToString();
                row[this.gridds_soluong.FieldName] = this.tbnumsoluong.Values;
                row[this.gridds_soluongtong.FieldName] = this.tbnumsoluong1.Values;
                row[this.gridds_hangsx.FieldName] = this.txthangsx.Text;
                try
                {
                    row[this.gridds_idquydoi.FieldName] = int.Parse(this.cbbdonggoi.EditValue.ToString());
                }
                catch
                {
                    row[this.gridds_idquydoi.FieldName] = 0;
                }
                row[this.gridds_dongia.FieldName] = this.tbnumdongia.Values.ToString();
                row[this.gridds_thanhtien.FieldName] = decimal.Parse(row[this.gridds_dongia.FieldName].ToString()) * decimal.Parse(row[this.gridds_soluong.FieldName].ToString());
                DataRow[] rowArray = ((DataTable) this.gridds.DataSource).Select(this.gridds_id.FieldName + "=" + row[this.gridds_id.FieldName].ToString());
                if (rowArray.Length > 0)
                {
                    if (MessageBox.Show("T\x00ean dược phẩm '" + row[this.gridds_ten.FieldName].ToString().ToUpper() + "' đ\x00e3 tồn tại.\nBạn c\x00f3 muốn cập nhật lại th\x00f4ng tin dược phẩm n\x00e0y kh\x00f4ng?", "Th\x00f4ng b\x00e1o", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                    {
                        rowArray[0][this.gridds_dongia.FieldName] = row[this.gridds_dongia.FieldName].ToString();
                        rowArray[0][this.gridds_soluong.FieldName] = row[this.gridds_soluong.FieldName].ToString();
                        rowArray[0][this.gridds_thanhtien.FieldName] = row[this.gridds_thanhtien.FieldName].ToString();
                    }
                }
                else
                {
                    dataSource.Rows.Add(row);
                }
                this.gridds.DataSource = dataSource;
                this.f_tinhtongtien();
            }
        }

        private void f_Control_enable(bool chophep)
        {
            this.btnluu.Enabled = this.btnboqua.Enabled = this.btnthem.Enabled = this.btnxoa.Enabled = chophep;
            this.btnhuy.Enabled = this.btnsua.Enabled = this.btnketthuc.Enabled = this.btnmoi.Enabled = !chophep;
            this.txtsophieu.Properties.ReadOnly = this.txtnguoidaidien.Properties.ReadOnly = this.datengay.Properties.ReadOnly = this.datengaygiao.Properties.ReadOnly = this.txtnguoidaidien.Properties.ReadOnly = this.txtdiachi.Properties.ReadOnly = this.txtdienthoai.Properties.ReadOnly = this.txtptgiaohang.Properties.ReadOnly = this.txtptthanhtoan.Properties.ReadOnly = this.txtghichu.Properties.ReadOnly = this.txtnhaccma.Properties.ReadOnly = this.txtnhaccten.Properties.ReadOnly = !chophep;
            this.txtsophieu.Properties.ReadOnly = true;
        }

        private void f_Loadcontrol_dathang(long iDPhieuDatHang, string sophieu, string ngay, string ngaygiao, int idnhacc, string phuongthucgiao, string phuongthucthanhtoan, string ghichu)
        {
            this.txtsophieu.Tag = iDPhieuDatHang.ToString();
            this.txtsophieu.Text = sophieu;
            try
            {
                this.datengay.EditValue = new DateTime(int.Parse(ngay.Substring(6, 4)), int.Parse(ngay.Substring(3, 2)), int.Parse(ngay.Substring(0, 2)), int.Parse(ngay.Substring(11, 2)), int.Parse(ngay.Substring(14, 2)), 0);
            }
            catch
            {
            }
            try
            {
                this.datengaygiao.EditValue = new DateTime(int.Parse(ngaygiao.Substring(6, 4)), int.Parse(ngaygiao.Substring(3, 2)), int.Parse(ngaygiao.Substring(0, 2)));
            }
            catch
            {
            }
            this.txtptthanhtoan.Text = phuongthucthanhtoan;
            this.txtptgiaohang.Text = phuongthucgiao;
            this.txtghichu.Text = ghichu;
            this.f_SetControl_dmnhacc((long) idnhacc);
        }

        private void f_Loadcontrol_dathangchitiet(long id, decimal soluong, decimal dongia, decimal soluongtong, int idquydoi, string hangsx)
        {
            this.lblmaso.Tag = id.ToString();
            this.tbnumsoluong.Values = soluong;
            this.tbnumdongia.Values = dongia;
            this.tbnumsoluong1.Values = soluongtong;
            this.tbnumsoluong.Values = soluong;
            this.txthangsx.Text = hangsx;
            try
            {
                this.cbbdonggoi.EditValue = idquydoi;
            }
            catch
            {
                this.cbbdonggoi.EditValue = 0;
            }
        }

        private void f_Loadcontrol_dmnhacc(long id, string ma, string ten, string diachi, string dienthoai, string nguoidaidien)
        {
            this.txtnhaccma.Text = ma;
            this.txtnhaccma.Tag = id.ToString();
            this.txtnhaccten.Text = ten;
            this.txtdiachi.Text = diachi;
            this.txtdienthoai.Text = dienthoai;
            this.txtnguoidaidien.Text = nguoidaidien;
        }

        private void f_Loadcontrol_dmvp(long id, string ma, string ten, string tenhoatchat, string dvt, string tennhasx)
        {
            this.txtma.Text = ma;
            this.txtma.Tag = id.ToString();
            this.txtten.Text = ten;
            this.txtdvt.Text = dvt;
            this.txthangsx.Text = tennhasx;
            this.txttenhoatchat.Text = tenhoatchat;
            try
            {
                this.cbbdonggoi.Properties.DataSource = new DDuocPham().f_loaddata_dmdonggoi(Convert.ToInt32(id));
                this.cbbdonggoi.Properties.DisplayMember = "ten";
                this.cbbdonggoi.Properties.ValueMember = "id";
                this.cbbdonggoi.ItemIndex = 0;
            }
            catch
            {
            }
        }

        private void f_Loaddata_dmnhacungcap()
        {
            try
            {
                this.ctrdanhsach_nhacc.SetDataSource = new dtoDDMNhaCungCap(this._xuli.pConFigData).LoadAll();
                this.ctrdanhsach_nhacc.DanhSachCotHienThi = "ma,ten,diachi";
            }
            catch
            {
            }
        }

        private void f_Loaddata_dmvp()
        {
            try
            {
                this.ctrdanhsach_vp.SetDataSource = new DDuocPham(this._xuli.pConFigData).f_loaddata_dmduocpham();
                this.ctrdanhsach_vp.DanhSachCotHienThi = "ma,ten,dvt";
            }
            catch
            {
            }
        }

        private void f_loaddata_phieudathangct(long idtoathuoc)
        {
            DataTable table = this._phieudathang.f_loaddata_dathangct(idtoathuoc);
            this.gridds.DataSource = table;
        }

        private void f_loadinfo_chidinhchitiet(int indexrow)
        {
            try
            {
                this.f_Loadcontrol_dmvp(long.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_id).ToString()), this.gridView1.GetRowCellValue(indexrow, this.gridds_ma).ToString(), this.gridView1.GetRowCellValue(indexrow, this.gridds_ten).ToString(), this.gridView1.GetRowCellValue(indexrow, this.gridds_tenhoatchat).ToString(), this.gridView1.GetRowCellValue(indexrow, this.gridds_dvt).ToString(), "");
                this.f_Loadcontrol_dathangchitiet(long.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_idphieuct).ToString()), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_soluong).ToString()), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_dongia).ToString()), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_soluongtong).ToString()), int.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_idquydoi).ToString()), this.gridView1.GetRowCellValue(indexrow, this.gridds_hangsx).ToString());
            }
            catch
            {
                this.f_Loadcontrol_dmvp(0L, "", "", "", "", "");
                this.f_Loadcontrol_dathangchitiet(0L, 0M, 0M, 0M, 0, "");
            }
        }

        private void f_SetControl_dmnhacc(long id)
        {
            try
            {
                DataRow[] rowArray = this.ctrdanhsach_nhacc.SetDataSource.Select("id=" + id.ToString());
                this.f_Loadcontrol_dmnhacc(id, rowArray[0]["ma"].ToString(), rowArray[0]["ten"].ToString(), rowArray[0]["diachi"].ToString(), rowArray[0]["dienthoai"].ToString(), rowArray[0]["daidien"].ToString());
            }
            catch
            {
                this.f_Loadcontrol_dmnhacc(0L, "", "", "", "", "");
            }
        }

        private void f_SetControl_dmsanpham(long idvp)
        {
            try
            {
                DataRow[] rowArray = this.ctrdanhsach_vp.SetDataSource.Select("id=" + idvp.ToString());
                this.f_Loadcontrol_dmvp(idvp, rowArray[0]["ma"].ToString(), rowArray[0]["ten"].ToString(), rowArray[0]["tenhoatchat"].ToString(), rowArray[0]["dvt"].ToString(), rowArray[0]["tennhasx"].ToString());
            }
            catch
            {
                this.f_Loadcontrol_dmvp(0L, "", "", "", "", "");
            }
        }

        private void f_setcontrol_phieudathang(long id)
        {
            dtoDPhieuDatHang hang = new dtoDPhieuDatHang(this._xuli.pConFigData) {
                pID = id
            };
            hang.Load();
            try
            {
                this.f_Loadcontrol_dathang(hang.pID, hang.pSOPHIEU.ToString(), hang.pNGAY, hang.pNGAYGIAO, hang.pIDNHACUNGCAP, hang.pPHUONGTHUCGIAOHANG, hang.pPHUONGTHUCTHANHTOAN, hang.pGHICHU);
            }
            catch
            {
                this.f_Loadcontrol_dathang(0L, "", DateTime.Now.ToString("dd/MM/yyyy HH:mm"), DateTime.Now.ToString("dd/MM/yyyy HH:mm"), 0, "", "", "");
            }
        }

        private void f_tinhtongtien()
        {
            try
            {
                decimal num = 0M;
                decimal num2 = 0M;
                DataTable dataSource = (DataTable) this.gridds.DataSource;
                for (int i = 0; i < dataSource.Rows.Count; i++)
                {
                    num += decimal.Parse(dataSource.Rows[i][this.gridds_thanhtien.FieldName].ToString());
                    num2 += decimal.Parse(dataSource.Rows[i][this.gridds_thanhtien.FieldName].ToString());
                }
            }
            catch
            {
            }
        }

        private void gridView1_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e)
        {
        }

        private void gridView1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            int indexrow = 0;
            try
            {
                if (this.gridView1.IsFocusedView)
                {
                    indexrow = this.gridView1.GetSelectedRows()[0];
                    this.f_loadinfo_chidinhchitiet(indexrow);
                }
            }
            catch
            {
            }
        }

        private void gridView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
        }

        private void gridView2_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            try
            {
                if (!this.btnluu.Enabled)
                {
                    int rowHandle = this.gridView2.GetSelectedRows()[0];
                    this.f_setcontrol_phieudathang(long.Parse(this.gridView2.GetRowCellValue(rowHandle, this.gridsp_id).ToString()));
                    this.f_loaddata_phieudathangct(long.Parse(this.txtsophieu.Tag.ToString()));
                    this.f_loadinfo_chidinhchitiet(0);
                }
            }
            catch
            {
            }
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ucd_phieudathang));
            StyleFormatCondition condition = new StyleFormatCondition();
            StyleFormatCondition condition2 = new StyleFormatCondition();
            this.gridds_dongia = new GridColumn();
            this.repositoryItemTextEdit2 = new RepositoryItemTextEdit();
            this.lblmaso = new Label();
            this.txtma = new TextEdit();
            this.txtten = new TextEdit();
            this.txtdvt = new TextEdit();
            this.btnthem = new SimpleButton();
            this.btnluu = new SimpleButton();
            this.btnsua = new SimpleButton();
            this.btnhuy = new SimpleButton();
            this.btnketthuc = new SimpleButton();
            this.gridView1 = new GridView();
            this.gridds_ma = new GridColumn();
            this.repositoryItemTextEdit1 = new RepositoryItemTextEdit();
            this.gridds_ten = new GridColumn();
            this.gridds_dvt = new GridColumn();
            this.gridds_id = new GridColumn();
            this.gridds_soluong = new GridColumn();
            this.gridds_thanhtien = new GridColumn();
            this.gridds_slxuat = new GridColumn();
            this.gridds_tenhoatchat = new GridColumn();
            this.gridds_hangsx = new GridColumn();
            this.gridds_soluongtong = new GridColumn();
            this.gridds_idquydoi = new GridColumn();
            this.gridds_idphieuct = new GridColumn();
            this.gridds = new GridControl();
            this.btnboqua = new SimpleButton();
            this.label1 = new Label();
            this.txtsophieu = new TextEdit();
            this.ctrdanhsach_vp = new ctrdanhsach();
            this.label10 = new Label();
            this.txtnhaccten = new TextEdit();
            this.txttenhoatchat = new TextEdit();
            this.label2 = new Label();
            this.label14 = new Label();
            this.label16 = new Label();
            this.txthangsx = new TextEdit();
            this.tbnumsoluong = new UCTextBoxNumeric();
            this.label8 = new Label();
            this.datengay = new DateEdit();
            this.label18 = new Label();
            this.txtnguoidaidien = new TextEdit();
            this.txtnhaccma = new TextEdit();
            this.tbnumsoluong1 = new UCTextBoxNumeric();
            this.cbbdonggoi = new LookUpEdit();
            this.label3 = new Label();
            this.ctrdanhsach_nhacc = new ctrdanhsach();
            this.btnmoi = new SimpleButton();
            this.btnxoa = new SimpleButton();
            this.label25 = new Label();
            this.groupControl1 = new GroupControl();
            this.datetungay = new DateEdit();
            this.datedenngay = new DateEdit();
            this.label27 = new Label();
            this.label26 = new Label();
            this.btntim = new SimpleButton();
            this.gridsp = new GridControl();
            this.gridView2 = new GridView();
            this.gridsp_id = new GridColumn();
            this.gridsp_ngay = new GridColumn();
            this.gridsp_sophieu = new GridColumn();
            this.repositoryItemTextEdit3 = new RepositoryItemTextEdit();
            this.repositoryItemTextEdit4 = new RepositoryItemTextEdit();
            this.label29 = new Label();
            this.txtdiachi = new TextEdit();
            this.btnthemduocpham = new SimpleButton();
            this.label6 = new Label();
            this.datengaygiao = new DateEdit();
            this.label9 = new Label();
            this.txtdienthoai = new TextEdit();
            this.label4 = new Label();
            this.txtptthanhtoan = new TextEdit();
            this.label5 = new Label();
            this.txtptgiaohang = new TextEdit();
            this.label7 = new Label();
            this.txtghichu = new TextEdit();
            this.tbnumdongia = new UCTextBoxNumeric();
            this.label11 = new Label();
            this.btnin = new SimpleButton();
            this.repositoryItemTextEdit2.BeginInit();
            this.txtma.Properties.BeginInit();
            this.txtten.Properties.BeginInit();
            this.txtdvt.Properties.BeginInit();
            this.gridView1.BeginInit();
            this.repositoryItemTextEdit1.BeginInit();
            this.gridds.BeginInit();
            this.txtsophieu.Properties.BeginInit();
            this.txtnhaccten.Properties.BeginInit();
            this.txttenhoatchat.Properties.BeginInit();
            this.txthangsx.Properties.BeginInit();
            this.datengay.Properties.VistaTimeProperties.BeginInit();
            this.datengay.Properties.BeginInit();
            this.txtnguoidaidien.Properties.BeginInit();
            this.txtnhaccma.Properties.BeginInit();
            this.cbbdonggoi.Properties.BeginInit();
            this.groupControl1.BeginInit();
            this.groupControl1.SuspendLayout();
            this.datetungay.Properties.VistaTimeProperties.BeginInit();
            this.datetungay.Properties.BeginInit();
            this.datedenngay.Properties.VistaTimeProperties.BeginInit();
            this.datedenngay.Properties.BeginInit();
            this.gridsp.BeginInit();
            this.gridView2.BeginInit();
            this.repositoryItemTextEdit3.BeginInit();
            this.repositoryItemTextEdit4.BeginInit();
            this.txtdiachi.Properties.BeginInit();
            this.datengaygiao.Properties.VistaTimeProperties.BeginInit();
            this.datengaygiao.Properties.BeginInit();
            this.txtdienthoai.Properties.BeginInit();
            this.txtptthanhtoan.Properties.BeginInit();
            this.txtptgiaohang.Properties.BeginInit();
            this.txtghichu.Properties.BeginInit();
            base.SuspendLayout();
            this.gridds_dongia.Caption = "Đơn gi\x00e1";
            this.gridds_dongia.ColumnEdit = this.repositoryItemTextEdit2;
            this.gridds_dongia.FieldName = "dongia";
            this.gridds_dongia.Name = "gridds_dongia";
            this.gridds_dongia.Visible = true;
            this.gridds_dongia.VisibleIndex = 3;
            this.gridds_dongia.Width = 0x42;
            this.repositoryItemTextEdit2.AutoHeight = false;
            this.repositoryItemTextEdit2.DisplayFormat.FormatString = "n0";
            this.repositoryItemTextEdit2.DisplayFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit2.EditFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit2.Mask.EditMask = "n0";
            this.repositoryItemTextEdit2.Mask.MaskType = MaskType.Numeric;
            this.repositoryItemTextEdit2.Name = "repositoryItemTextEdit2";
            this.lblmaso.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.lblmaso.Font = new Font("Tahoma", 10f);
            this.lblmaso.Location = new Point(8, 400);
            this.lblmaso.Name = "lblmaso";
            this.lblmaso.Size = new Size(0x60, 0x13);
            this.lblmaso.TabIndex = 2;
            this.lblmaso.Text = "Dược phẩm:";
            this.lblmaso.TextAlign = ContentAlignment.TopRight;
            this.txtma.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.txtma.Location = new Point(100, 0x18f);
            this.txtma.Name = "txtma";
            this.txtma.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtma.Size = new Size(0x4c, 20);
            this.txtma.TabIndex = 12;
            this.txtma.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.txtma.Validated += new EventHandler(this.txtma_Validated);
            this.txtten.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.txtten.Location = new Point(0xb1, 0x18f);
            this.txtten.Name = "txtten";
            this.txtten.Size = new Size(0x1fc, 20);
            this.txtten.TabIndex = 13;
            this.txtten.TextChanged += new EventHandler(this.txtten_TextChanged);
            this.txtten.Enter += new EventHandler(this.txtten_Enter);
            this.txtten.KeyDown += new KeyEventHandler(this.txtten_KeyDown);
            this.txtten.Validated += new EventHandler(this.txtten_Validated);
            this.txtdvt.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.txtdvt.EditValue = "";
            this.txtdvt.Enabled = false;
            this.txtdvt.Location = new Point(370, 0x1a9);
            this.txtdvt.Name = "txtdvt";
            this.txtdvt.Size = new Size(0x33, 20);
            this.txtdvt.TabIndex = 20;
            this.txtdvt.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.btnthem.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnthem.Appearance.Options.UseTextOptions = true;
            this.btnthem.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnthem.Image = (Image) manager.GetObject("btnthem.Image");
            this.btnthem.Location = new Point(0x55, 0x1c8);
            this.btnthem.Name = "btnthem";
            this.btnthem.Size = new Size(0x4b, 0x17);
            this.btnthem.TabIndex = 0x15;
            this.btnthem.Text = " &Th\x00eam [F1]";
            this.btnthem.Click += new EventHandler(this.btnmoi_Click);
            this.btnluu.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnluu.Appearance.Options.UseTextOptions = true;
            this.btnluu.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnluu.Image = Properties.Resources.imgsave;// (Image)manager.GetObject("btnluu.Image");
            this.btnluu.Location = new Point(0xe8, 0x1c8);
            this.btnluu.Name = "btnluu";
            this.btnluu.Size = new Size(0x4b, 0x17);
            this.btnluu.TabIndex = 0x17;
            this.btnluu.Text = " &Lưu [F5]";
            this.btnluu.Click += new EventHandler(this.btnluu_Click);
            this.btnsua.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnsua.Appearance.Options.UseTextOptions = true;
            this.btnsua.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnsua.Image = Properties.Resources.imgedit;// (Image)manager.GetObject("btnsua.Image");
            this.btnsua.Location = new Point(310, 0x1c8);
            this.btnsua.Name = "btnsua";
            this.btnsua.Size = new Size(0x4b, 0x17);
            this.btnsua.TabIndex = 0x19;
            this.btnsua.Text = " &Sửa [F3]";
            this.btnsua.Click += new EventHandler(this.btnsua_Click);
            this.btnhuy.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnhuy.Image = (Image) manager.GetObject("btnhuy.Image");
            this.btnhuy.Location = new Point(0x1df, 0x1c8);
            this.btnhuy.Name = "btnhuy";
            this.btnhuy.Size = new Size(0x4b, 0x17);
            this.btnhuy.TabIndex = 0x1b;
            this.btnhuy.Text = " &Hủy [F7]";
            this.btnhuy.Click += new EventHandler(this.btnhuy_Click);
            this.btnketthuc.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btnketthuc.Appearance.Options.UseTextOptions = true;
            this.btnketthuc.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnketthuc.Image = Properties.Resources.imgclose;// (Image)manager.GetObject("btnketthuc.Image");
            this.btnketthuc.Location = new Point(0x397, 0x1c8);
            this.btnketthuc.Name = "btnketthuc";
            this.btnketthuc.Size = new Size(0x65, 0x17);
            this.btnketthuc.TabIndex = 0x1d;
            this.btnketthuc.Text = " &Kết th\x00fac [F12]";
            this.btnketthuc.Click += new EventHandler(this.btnketthuc_Click);
            this.gridView1.Appearance.ColumnFilterButton.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.ColumnFilterButton.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.ColumnFilterButton.ForeColor = Color.Black;
            this.gridView1.Appearance.ColumnFilterButton.Options.UseBackColor = true;
            this.gridView1.Appearance.ColumnFilterButton.Options.UseBorderColor = true;
            this.gridView1.Appearance.ColumnFilterButton.Options.UseForeColor = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.ColumnFilterButtonActive.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.ColumnFilterButtonActive.ForeColor = Color.Black;
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseBackColor = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseBorderColor = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseForeColor = true;
            this.gridView1.Appearance.Empty.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.Empty.BackColor2 = Color.White;
            this.gridView1.Appearance.Empty.Options.UseBackColor = true;
            this.gridView1.Appearance.EvenRow.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.EvenRow.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.EvenRow.ForeColor = Color.Black;
            this.gridView1.Appearance.EvenRow.Options.UseBackColor = true;
            this.gridView1.Appearance.EvenRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.EvenRow.Options.UseForeColor = true;
            this.gridView1.Appearance.FilterCloseButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.FilterCloseButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.FilterCloseButton.ForeColor = Color.Black;
            this.gridView1.Appearance.FilterCloseButton.Options.UseBackColor = true;
            this.gridView1.Appearance.FilterCloseButton.Options.UseBorderColor = true;
            this.gridView1.Appearance.FilterCloseButton.Options.UseForeColor = true;
            this.gridView1.Appearance.FilterPanel.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.FilterPanel.BackColor2 = Color.White;
            this.gridView1.Appearance.FilterPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.FilterPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.FilterPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.FixedLine.BackColor = Color.FromArgb(0x7a, 0x72, 0x71);
            this.gridView1.Appearance.FixedLine.Options.UseBackColor = true;
            this.gridView1.Appearance.FocusedCell.BackColor = Color.White;
            this.gridView1.Appearance.FocusedCell.ForeColor = Color.Black;
            this.gridView1.Appearance.FocusedCell.Options.UseBackColor = true;
            this.gridView1.Appearance.FocusedCell.Options.UseForeColor = true;
            this.gridView1.Appearance.FocusedRow.BackColor = Color.FromArgb(200, 0xc0, 0x9d);
            this.gridView1.Appearance.FocusedRow.BorderColor = Color.FromArgb(0xe2, 0xdb, 0xbc);
            this.gridView1.Appearance.FocusedRow.ForeColor = Color.Black;
            this.gridView1.Appearance.FocusedRow.Options.UseBackColor = true;
            this.gridView1.Appearance.FocusedRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.FocusedRow.Options.UseForeColor = true;
            this.gridView1.Appearance.FooterPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.FooterPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.FooterPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.FooterPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.FooterPanel.Options.UseBorderColor = true;
            this.gridView1.Appearance.FooterPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.GroupButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.GroupButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.GroupButton.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupButton.Options.UseBorderColor = true;
            this.gridView1.Appearance.GroupFooter.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupFooter.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupFooter.ForeColor = Color.Black;
            this.gridView1.Appearance.GroupFooter.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupFooter.Options.UseBorderColor = true;
            this.gridView1.Appearance.GroupFooter.Options.UseForeColor = true;
            this.gridView1.Appearance.GroupPanel.BackColor = Color.FromArgb(0xf6, 0xf2, 0xd5);
            this.gridView1.Appearance.GroupPanel.BackColor2 = Color.White;
            this.gridView1.Appearance.GroupPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.GroupPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.GroupRow.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupRow.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupRow.ForeColor = Color.Black;
            this.gridView1.Appearance.GroupRow.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.GroupRow.Options.UseForeColor = true;
            this.gridView1.Appearance.HeaderPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.HeaderPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.HeaderPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.HeaderPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.HeaderPanel.Options.UseBorderColor = true;
            this.gridView1.Appearance.HeaderPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.HideSelectionRow.BackColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView1.Appearance.HideSelectionRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView1.Appearance.HideSelectionRow.ForeColor = Color.Black;
            this.gridView1.Appearance.HideSelectionRow.Options.UseBackColor = true;
            this.gridView1.Appearance.HideSelectionRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.HideSelectionRow.Options.UseForeColor = true;
            this.gridView1.Appearance.HorzLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.HorzLine.Options.UseBackColor = true;
            this.gridView1.Appearance.OddRow.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView1.Appearance.OddRow.BorderColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView1.Appearance.OddRow.ForeColor = Color.Black;
            this.gridView1.Appearance.OddRow.Options.UseBackColor = true;
            this.gridView1.Appearance.OddRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.OddRow.Options.UseForeColor = true;
            this.gridView1.Appearance.Preview.BackColor = Color.FromArgb(0xfb, 0xfc, 0xf7);
            this.gridView1.Appearance.Preview.Font = new Font("Verdana", 7.5f);
            this.gridView1.Appearance.Preview.ForeColor = Color.FromArgb(0x94, 0x94, 0x94);
            this.gridView1.Appearance.Preview.Options.UseBackColor = true;
            this.gridView1.Appearance.Preview.Options.UseFont = true;
            this.gridView1.Appearance.Preview.Options.UseForeColor = true;
            this.gridView1.Appearance.Row.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView1.Appearance.Row.ForeColor = Color.Black;
            this.gridView1.Appearance.Row.Options.UseBackColor = true;
            this.gridView1.Appearance.Row.Options.UseForeColor = true;
            this.gridView1.Appearance.RowSeparator.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.RowSeparator.BackColor2 = Color.White;
            this.gridView1.Appearance.RowSeparator.Options.UseBackColor = true;
            this.gridView1.Appearance.SelectedRow.BackColor = Color.FromArgb(0xdd, 0xd7, 0xbc);
            this.gridView1.Appearance.SelectedRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView1.Appearance.SelectedRow.ForeColor = Color.Black;
            this.gridView1.Appearance.SelectedRow.Options.UseBackColor = true;
            this.gridView1.Appearance.SelectedRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.SelectedRow.Options.UseForeColor = true;
            this.gridView1.Appearance.TopNewRow.BackColor = Color.White;
            this.gridView1.Appearance.TopNewRow.Options.UseBackColor = true;
            this.gridView1.Appearance.VertLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.VertLine.Options.UseBackColor = true;
            this.gridView1.Columns.AddRange(new GridColumn[] { this.gridds_ma, this.gridds_ten, this.gridds_dvt, this.gridds_id, this.gridds_dongia, this.gridds_soluong, this.gridds_thanhtien, this.gridds_slxuat, this.gridds_tenhoatchat, this.gridds_hangsx, this.gridds_soluongtong, this.gridds_idquydoi, this.gridds_idphieuct });
            condition.Appearance.ForeColor = Color.Red;
            condition.Appearance.Options.UseForeColor = true;
            condition.Column = this.gridds_dongia;
            condition.Condition = FormatConditionEnum.Between;
            condition.Value1 = "0";
            condition.Value2 = "0";
            this.gridView1.FormatConditions.AddRange(new StyleFormatCondition[] { condition });
            this.gridView1.GridControl = this.gridds;
            this.gridView1.Name = "gridView1";
            this.gridView1.OptionsBehavior.AllowAddRows = DefaultBoolean.True;
            this.gridView1.OptionsBehavior.AllowDeleteRows = DefaultBoolean.False;
            this.gridView1.OptionsBehavior.ReadOnly = true;
            this.gridView1.OptionsView.AutoCalcPreviewLineCount = true;
            this.gridView1.OptionsView.EnableAppearanceEvenRow = true;
            this.gridView1.OptionsView.EnableAppearanceOddRow = true;
            this.gridView1.OptionsView.ShowAutoFilterRow = true;
            this.gridView1.OptionsView.ShowFooter = true;
            this.gridView1.OptionsView.ShowGroupPanel = false;
            this.gridView1.RowCellStyle += new RowCellStyleEventHandler(this.gridView1_RowCellStyle);
            this.gridView1.CustomSummaryCalculate += new CustomSummaryEventHandler(this.gridView1_CustomSummaryCalculate);
            this.gridView1.FocusedRowChanged += new FocusedRowChangedEventHandler(this.gridView1_FocusedRowChanged);
            this.gridds_ma.Caption = "M\x00e3 số";
            this.gridds_ma.ColumnEdit = this.repositoryItemTextEdit1;
            this.gridds_ma.FieldName = "madp";
            this.gridds_ma.Name = "gridds_ma";
            this.gridds_ma.OptionsColumn.AllowEdit = false;
            this.gridds_ma.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(SummaryItemType.Count, "ma", "Tổng cộng={0:n0}") });
            this.gridds_ma.Visible = true;
            this.gridds_ma.VisibleIndex = 0;
            this.gridds_ma.Width = 0x57;
            this.repositoryItemTextEdit1.AutoHeight = false;
            this.repositoryItemTextEdit1.Name = "repositoryItemTextEdit1";
            this.repositoryItemTextEdit1.ReadOnly = true;
            this.gridds_ten.Caption = "T\x00ean dược phẩm";
            this.gridds_ten.ColumnEdit = this.repositoryItemTextEdit1;
            this.gridds_ten.FieldName = "tendp";
            this.gridds_ten.Name = "gridds_ten";
            this.gridds_ten.OptionsColumn.AllowEdit = false;
            this.gridds_ten.Visible = true;
            this.gridds_ten.VisibleIndex = 1;
            this.gridds_ten.Width = 0xf3;
            this.gridds_dvt.Caption = "ĐVT";
            this.gridds_dvt.ColumnEdit = this.repositoryItemTextEdit1;
            this.gridds_dvt.FieldName = "dvt";
            this.gridds_dvt.Name = "gridds_dvt";
            this.gridds_dvt.OptionsColumn.AllowEdit = false;
            this.gridds_dvt.Visible = true;
            this.gridds_dvt.VisibleIndex = 2;
            this.gridds_dvt.Width = 40;
            this.gridds_id.Caption = "id";
            this.gridds_id.FieldName = "iddp";
            this.gridds_id.Name = "gridds_id";
            this.gridds_soluong.Caption = "SL";
            this.gridds_soluong.ColumnEdit = this.repositoryItemTextEdit2;
            this.gridds_soluong.FieldName = "soluong";
            this.gridds_soluong.Name = "gridds_soluong";
            this.gridds_soluong.Visible = true;
            this.gridds_soluong.VisibleIndex = 4;
            this.gridds_soluong.Width = 0x29;
            this.gridds_thanhtien.Caption = "Th\x00e0nh tiền";
            this.gridds_thanhtien.ColumnEdit = this.repositoryItemTextEdit2;
            this.gridds_thanhtien.FieldName = "thanhtien";
            this.gridds_thanhtien.Name = "gridds_thanhtien";
            this.gridds_thanhtien.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(SummaryItemType.Sum, "thanhtien", "Tổng tiền: {0:n0}") });
            this.gridds_thanhtien.Visible = true;
            this.gridds_thanhtien.VisibleIndex = 5;
            this.gridds_thanhtien.Width = 0x7a;
            this.gridds_slxuat.Caption = "sldathanhtoan";
            this.gridds_slxuat.FieldName = "soluongxuat";
            this.gridds_slxuat.Name = "gridds_slxuat";
            this.gridds_tenhoatchat.Caption = "tenhoatchat";
            this.gridds_tenhoatchat.FieldName = "tenhoatchat";
            this.gridds_tenhoatchat.Name = "gridds_tenhoatchat";
            this.gridds_hangsx.Caption = "hangsx";
            this.gridds_hangsx.FieldName = "hangsx";
            this.gridds_hangsx.Name = "gridds_hangsx";
            this.gridds_soluongtong.Caption = "soluongtong";
            this.gridds_soluongtong.FieldName = "soluongtong";
            this.gridds_soluongtong.Name = "gridds_soluongtong";
            this.gridds_idquydoi.Caption = "idquydoi";
            this.gridds_idquydoi.FieldName = "idquydoi";
            this.gridds_idquydoi.Name = "gridds_idquydoi";
            this.gridds_idphieuct.Caption = "idphieuct";
            this.gridds_idphieuct.FieldName = "id";
            this.gridds_idphieuct.Name = "gridds_idphieuct";
            this.gridds.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.gridds.Location = new Point(3, 0x9e);
            this.gridds.MainView = this.gridView1;
            this.gridds.Name = "gridds";
            this.gridds.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemTextEdit1, this.repositoryItemTextEdit2 });
            this.gridds.Size = new Size(0x2fd, 0xeb);
            this.gridds.TabIndex = 0x1c;
            this.gridds.ViewCollection.AddRange(new BaseView[] { this.gridView1 });
            this.btnboqua.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnboqua.Image = Properties.Resources.imgundo;// (Image)manager.GetObject("btnboqua.Image");
            this.btnboqua.Location = new Point(0x184, 0x1c8);
            this.btnboqua.Name = "btnboqua";
            this.btnboqua.Size = new Size(0x57, 0x17);
            this.btnboqua.TabIndex = 0x1a;
            this.btnboqua.Text = " &Bỏ qua [F4]";
            this.btnboqua.Click += new EventHandler(this.btnboqua_Click);
            this.label1.Font = new Font("Tahoma", 10f);
            this.label1.Location = new Point(0x11, 0x33);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x53, 0x13);
            this.label1.TabIndex = 2;
            this.label1.Text = "Số phiếu:";
            this.label1.TextAlign = ContentAlignment.TopRight;
            this.txtsophieu.Location = new Point(0x60, 50);
            this.txtsophieu.Name = "txtsophieu";
            this.txtsophieu.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtsophieu.Properties.MaxLength = 10;
            this.txtsophieu.Size = new Size(0x4c, 20);
            this.txtsophieu.TabIndex = 0;
            this.txtsophieu.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.ctrdanhsach_vp.ChieuRongTuDong = true;
            this.ctrdanhsach_vp.DanhSachCotHienThi = "";
            this.ctrdanhsach_vp.DanhSachCotHienThi_kt = "";
            this.ctrdanhsach_vp.Location = new Point(0x355, 0x1c8);
            this.ctrdanhsach_vp.Name = "ctrdanhsach_vp";
            this.ctrdanhsach_vp.pRowsCountDown = 5;
            this.ctrdanhsach_vp.Size = new Size(60, 0x13);
            this.ctrdanhsach_vp.TabIndex = 14;
            this.ctrdanhsach_vp.Visible = false;
            this.ctrdanhsach_vp.Validated += new EventHandler(this.ctrdanhsach_vp_Validated);
            this.label10.Font = new Font("Tahoma", 10f);
            this.label10.Location = new Point(-3, 0x4d);
            this.label10.Name = "label10";
            this.label10.Size = new Size(0x67, 0x13);
            this.label10.TabIndex = 2;
            this.label10.Text = "Nh\x00e0 cung cấp:";
            this.label10.TextAlign = ContentAlignment.TopRight;
            this.txtnhaccten.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtnhaccten.Location = new Point(0xad, 0x4c);
            this.txtnhaccten.Name = "txtnhaccten";
            this.txtnhaccten.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtnhaccten.Size = new Size(0x150, 20);
            this.txtnhaccten.TabIndex = 4;
            this.txtnhaccten.TextChanged += new EventHandler(this.txtnhaccten_TextChanged);
            this.txtnhaccten.Enter += new EventHandler(this.txtnhaccten_Enter);
            this.txtnhaccten.KeyDown += new KeyEventHandler(this.txtnhaccten_KeyDown);
            this.txttenhoatchat.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
            this.txttenhoatchat.Enabled = false;
            this.txttenhoatchat.Location = new Point(0x32b, 0x18f);
            this.txttenhoatchat.Name = "txttenhoatchat";
            this.txttenhoatchat.Size = new Size(0xd1, 20);
            this.txttenhoatchat.TabIndex = 15;
            this.txttenhoatchat.TextChanged += new EventHandler(this.txtten_TextChanged);
            this.txttenhoatchat.Enter += new EventHandler(this.txtten_Enter);
            this.txttenhoatchat.KeyDown += new KeyEventHandler(this.txtten_KeyDown);
            this.txttenhoatchat.Validated += new EventHandler(this.txtten_Validated);
            this.label2.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label2.Font = new Font("Tahoma", 10f);
            this.label2.Location = new Point(0x2d1, 400);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x57, 0x13);
            this.label2.TabIndex = 2;
            this.label2.Text = "Hoạt chất:";
            this.label2.TextAlign = ContentAlignment.TopRight;
            this.label14.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label14.Font = new Font("Tahoma", 10f);
            this.label14.Location = new Point(11, 0x1aa);
            this.label14.Name = "label14";
            this.label14.Size = new Size(0x5d, 0x13);
            this.label14.TabIndex = 2;
            this.label14.Text = "Số lượng:";
            this.label14.TextAlign = ContentAlignment.TopRight;
            this.label16.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label16.Font = new Font("Tahoma", 10f);
            this.label16.Location = new Point(0x2c8, 0x1aa);
            this.label16.Name = "label16";
            this.label16.Size = new Size(0x60, 0x13);
            this.label16.TabIndex = 2;
            this.label16.Text = "Nh\x00e0 sản xuất:";
            this.label16.TextAlign = ContentAlignment.TopRight;
            this.txthangsx.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
            this.txthangsx.EditValue = "";
            this.txthangsx.Enabled = false;
            this.txthangsx.Location = new Point(0x32b, 0x1a9);
            this.txthangsx.Name = "txthangsx";
            this.txthangsx.Size = new Size(0xd1, 20);
            this.txthangsx.TabIndex = 20;
            this.txthangsx.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.tbnumsoluong.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.tbnumsoluong.BackColor = Color.White;
            this.tbnumsoluong.DecimalBalance = 0;
            this.tbnumsoluong.Enabled = false;
            this.tbnumsoluong.Location = new Point(310, 0x1a9);
            this.tbnumsoluong.Name = "tbnumsoluong";
            this.tbnumsoluong.ReadOnly = false;
            this.tbnumsoluong.Size = new Size(0x39, 20);
            this.tbnumsoluong.SymbolDecimal = ",";
            this.tbnumsoluong.SymbolThousand = ".";
            this.tbnumsoluong.TabIndex = 0x12;
            this.tbnumsoluong.Texts = "0";
            int[] bits = new int[4];
            this.tbnumsoluong.Values = new decimal(bits);
            this.tbnumsoluong.Validated += new EventHandler(this.tbnumsoluong_Validated);
            this.label8.Font = new Font("Tahoma", 10f);
            this.label8.Location = new Point(0xad, 0x33);
            this.label8.Name = "label8";
            this.label8.Size = new Size(0x75, 0x13);
            this.label8.TabIndex = 2;
            this.label8.Text = "Ng\x00e0y đặt h\x00e0ng:";
            this.label8.TextAlign = ContentAlignment.TopRight;
            this.datengay.EditValue = new DateTime(0x7dd, 11, 8, 2, 0x16, 9, 0x297);
            this.datengay.Location = new Point(0x120, 50);
            this.datengay.Name = "datengay";
            this.datengay.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datengay.Properties.DisplayFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengay.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datengay.Properties.EditFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengay.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datengay.Properties.Mask.EditMask = "dd/MM/yyyy HH:mm";
            this.datengay.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datengay.Size = new Size(0x7a, 20);
            this.datengay.TabIndex = 1;
            this.datengay.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label18.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label18.Font = new Font("Tahoma", 10f);
            this.label18.Location = new Point(0x20b, 0x4b);
            this.label18.Name = "label18";
            this.label18.Size = new Size(0x5e, 0x13);
            this.label18.TabIndex = 2;
            this.label18.Text = "Người li\x00ean hệ:";
            this.label18.TextAlign = ContentAlignment.TopRight;
            this.txtnguoidaidien.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.txtnguoidaidien.Location = new Point(0x264, 0x4a);
            this.txtnguoidaidien.Name = "txtnguoidaidien";
            this.txtnguoidaidien.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtnguoidaidien.Size = new Size(0x97, 20);
            this.txtnguoidaidien.TabIndex = 6;
            this.txtnguoidaidien.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.txtnhaccma.Location = new Point(0x60, 0x4c);
            this.txtnhaccma.Name = "txtnhaccma";
            this.txtnhaccma.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtnhaccma.Size = new Size(0x4c, 20);
            this.txtnhaccma.TabIndex = 3;
            this.txtnhaccma.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.tbnumsoluong1.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.tbnumsoluong1.BackColor = Color.White;
            this.tbnumsoluong1.DecimalBalance = 0;
            this.tbnumsoluong1.Location = new Point(100, 0x1a9);
            this.tbnumsoluong1.Name = "tbnumsoluong1";
            this.tbnumsoluong1.ReadOnly = false;
            this.tbnumsoluong1.Size = new Size(0x4c, 20);
            this.tbnumsoluong1.SymbolDecimal = ",";
            this.tbnumsoluong1.SymbolThousand = ".";
            this.tbnumsoluong1.TabIndex = 0x10;
            this.tbnumsoluong1.Texts = "0";
            bits = new int[4];
            this.tbnumsoluong1.Values = new decimal(bits);
            this.tbnumsoluong1.Validated += new EventHandler(this.tbnumsoluong1_Validated);
            this.cbbdonggoi.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.cbbdonggoi.Location = new Point(0xb1, 0x1a9);
            this.cbbdonggoi.Name = "cbbdonggoi";
            this.cbbdonggoi.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.cbbdonggoi.Properties.Columns.AddRange(new LookUpColumnInfo[] { new LookUpColumnInfo("id", "id", 20, FormatType.None, "", false, HorzAlignment.Default), new LookUpColumnInfo("ten", "T\x00ean") });
            this.cbbdonggoi.Size = new Size(0x71, 20);
            this.cbbdonggoi.TabIndex = 0x11;
            this.cbbdonggoi.EditValueChanged += new EventHandler(this.cbbdonggoi_EditValueChanged);
            this.cbbdonggoi.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label3.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label3.Font = new Font("Tahoma", 10f);
            this.label3.Location = new Point(290, 0x1a9);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x16, 0x13);
            this.label3.TabIndex = 2;
            this.label3.Text = "=";
            this.label3.TextAlign = ContentAlignment.TopRight;
            this.ctrdanhsach_nhacc.ChieuRongTuDong = true;
            this.ctrdanhsach_nhacc.DanhSachCotHienThi = "";
            this.ctrdanhsach_nhacc.DanhSachCotHienThi_kt = "";
            this.ctrdanhsach_nhacc.Location = new Point(0, 0x37);
            this.ctrdanhsach_nhacc.Name = "ctrdanhsach_nhacc";
            this.ctrdanhsach_nhacc.pRowsCountDown = 5;
            this.ctrdanhsach_nhacc.Size = new Size(0x23, 0x13);
            this.ctrdanhsach_nhacc.TabIndex = 5;
            this.ctrdanhsach_nhacc.Visible = false;
            this.ctrdanhsach_nhacc.Validated += new EventHandler(this.ctrdanhsach_nhacc_Validated);
            this.btnmoi.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnmoi.Appearance.Options.UseTextOptions = true;
            this.btnmoi.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnmoi.Image = Properties.Resources.imgnew;// (Image)manager.GetObject("btnmoi.Image");
            this.btnmoi.Location = new Point(9, 0x1c8);
            this.btnmoi.Name = "btnmoi";
            this.btnmoi.Size = new Size(0x4b, 0x17);
            this.btnmoi.TabIndex = 0x16;
            this.btnmoi.Text = " &Mới [F2]";
            this.btnmoi.Click += new EventHandler(this.btnmoi_Click_1);
            this.btnxoa.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnxoa.Image = Properties.Resources.imgdelete;// (Image)manager.GetObject("btnxoa.Image");
            this.btnxoa.Location = new Point(0xa2, 0x1c8);
            this.btnxoa.Name = "btnxoa";
            this.btnxoa.Size = new Size(0x42, 0x17);
            this.btnxoa.TabIndex = 0x18;
            this.btnxoa.Text = " &X\x00f3a";
            this.btnxoa.Click += new EventHandler(this.btnxoa_Click);
            this.label25.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.label25.BackColor = Color.Green;
            this.label25.Font = new Font("Tahoma", 16f);
            this.label25.ForeColor = Color.White;
            this.label25.Location = new Point(0, 0);
            this.label25.Name = "label25";
            this.label25.Size = new Size(0x401, 0x2d);
            this.label25.TabIndex = 2;
            this.label25.Text = "PHIẾU ĐẶT H\x00c0NG";
            this.label25.TextAlign = ContentAlignment.MiddleLeft;
            this.groupControl1.Anchor = AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top;
            this.groupControl1.Appearance.Font = new Font("Tahoma", 10f);
            this.groupControl1.Appearance.Options.UseFont = true;
            this.groupControl1.AppearanceCaption.Font = new Font("Tahoma", 10f, FontStyle.Bold);
            this.groupControl1.AppearanceCaption.Options.UseFont = true;
            this.groupControl1.Controls.Add(this.datetungay);
            this.groupControl1.Controls.Add(this.datedenngay);
            this.groupControl1.Controls.Add(this.label27);
            this.groupControl1.Controls.Add(this.label26);
            this.groupControl1.Controls.Add(this.btntim);
            this.groupControl1.Controls.Add(this.gridsp);
            this.groupControl1.Location = new Point(0x301, 0x31);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new Size(0xff, 0x158);
            this.groupControl1.TabIndex = 0x29;
            this.groupControl1.Text = "Phiếu đ\x00e3 nhập";
            this.datetungay.EditValue = new DateTime(0x7dd, 11, 8, 2, 0x16, 9, 0x297);
            this.datetungay.Location = new Point(0x21, 30);
            this.datetungay.Name = "datetungay";
            this.datetungay.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datetungay.Properties.DisplayFormat.FormatString = "dd/MM/yyyy";
            this.datetungay.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datetungay.Properties.EditFormat.FormatString = "dd/MM/yyyy";
            this.datetungay.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datetungay.Properties.Mask.EditMask = "dd/MM/yyyy";
            this.datetungay.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datetungay.Size = new Size(80, 20);
            this.datetungay.TabIndex = 0;
            this.datedenngay.EditValue = new DateTime(0x7dd, 11, 8, 2, 0x16, 9, 0x297);
            this.datedenngay.Location = new Point(0x91, 30);
            this.datedenngay.Name = "datedenngay";
            this.datedenngay.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datedenngay.Properties.DisplayFormat.FormatString = "dd/MM/yyyy";
            this.datedenngay.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datedenngay.Properties.EditFormat.FormatString = "dd/MM/yyyy";
            this.datedenngay.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datedenngay.Properties.Mask.EditMask = "dd/MM/yyyy";
            this.datedenngay.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datedenngay.Size = new Size(80, 20);
            this.datedenngay.TabIndex = 1;
            this.label27.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label27.Font = new Font("Tahoma", 10f);
            this.label27.Location = new Point(0x6d, 30);
            this.label27.Name = "label27";
            this.label27.Size = new Size(0x23, 0x13);
            this.label27.TabIndex = 2;
            this.label27.Text = "đến:";
            this.label27.TextAlign = ContentAlignment.TopRight;
            this.label26.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label26.Font = new Font("Tahoma", 10f);
            this.label26.Location = new Point(2, 30);
            this.label26.Name = "label26";
            this.label26.Size = new Size(30, 0x13);
            this.label26.TabIndex = 2;
            this.label26.Text = "Từ:";
            this.label26.TextAlign = ContentAlignment.TopRight;
            this.btntim.Image = (Image) manager.GetObject("btntim.Image");
            this.btntim.Location = new Point(0xe3, 30);
            this.btntim.Name = "btntim";
            this.btntim.Size = new Size(0x1a, 20);
            this.btntim.TabIndex = 2;
            this.btntim.Click += new EventHandler(this.btntim_Click);
            this.gridsp.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.gridsp.Location = new Point(4, 0x38);
            this.gridsp.MainView = this.gridView2;
            this.gridsp.Name = "gridsp";
            this.gridsp.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemTextEdit3, this.repositoryItemTextEdit4 });
            this.gridsp.Size = new Size(0xf8, 0x120);
            this.gridsp.TabIndex = 3;
            this.gridsp.ViewCollection.AddRange(new BaseView[] { this.gridView2 });
            this.gridView2.Appearance.ColumnFilterButton.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.ColumnFilterButton.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.ColumnFilterButton.ForeColor = Color.Black;
            this.gridView2.Appearance.ColumnFilterButton.Options.UseBackColor = true;
            this.gridView2.Appearance.ColumnFilterButton.Options.UseBorderColor = true;
            this.gridView2.Appearance.ColumnFilterButton.Options.UseForeColor = true;
            this.gridView2.Appearance.ColumnFilterButtonActive.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView2.Appearance.ColumnFilterButtonActive.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView2.Appearance.ColumnFilterButtonActive.ForeColor = Color.Black;
            this.gridView2.Appearance.ColumnFilterButtonActive.Options.UseBackColor = true;
            this.gridView2.Appearance.ColumnFilterButtonActive.Options.UseBorderColor = true;
            this.gridView2.Appearance.ColumnFilterButtonActive.Options.UseForeColor = true;
            this.gridView2.Appearance.Empty.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.Empty.BackColor2 = Color.White;
            this.gridView2.Appearance.Empty.Options.UseBackColor = true;
            this.gridView2.Appearance.EvenRow.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView2.Appearance.EvenRow.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView2.Appearance.EvenRow.ForeColor = Color.Black;
            this.gridView2.Appearance.EvenRow.Options.UseBackColor = true;
            this.gridView2.Appearance.EvenRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.EvenRow.Options.UseForeColor = true;
            this.gridView2.Appearance.FilterCloseButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView2.Appearance.FilterCloseButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView2.Appearance.FilterCloseButton.ForeColor = Color.Black;
            this.gridView2.Appearance.FilterCloseButton.Options.UseBackColor = true;
            this.gridView2.Appearance.FilterCloseButton.Options.UseBorderColor = true;
            this.gridView2.Appearance.FilterCloseButton.Options.UseForeColor = true;
            this.gridView2.Appearance.FilterPanel.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.FilterPanel.BackColor2 = Color.White;
            this.gridView2.Appearance.FilterPanel.ForeColor = Color.Black;
            this.gridView2.Appearance.FilterPanel.Options.UseBackColor = true;
            this.gridView2.Appearance.FilterPanel.Options.UseForeColor = true;
            this.gridView2.Appearance.FixedLine.BackColor = Color.FromArgb(0x7a, 0x72, 0x71);
            this.gridView2.Appearance.FixedLine.Options.UseBackColor = true;
            this.gridView2.Appearance.FocusedCell.BackColor = Color.White;
            this.gridView2.Appearance.FocusedCell.ForeColor = Color.Black;
            this.gridView2.Appearance.FocusedCell.Options.UseBackColor = true;
            this.gridView2.Appearance.FocusedCell.Options.UseForeColor = true;
            this.gridView2.Appearance.FocusedRow.BackColor = Color.FromArgb(200, 0xc0, 0x9d);
            this.gridView2.Appearance.FocusedRow.BorderColor = Color.FromArgb(0xe2, 0xdb, 0xbc);
            this.gridView2.Appearance.FocusedRow.ForeColor = Color.Black;
            this.gridView2.Appearance.FocusedRow.Options.UseBackColor = true;
            this.gridView2.Appearance.FocusedRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.FocusedRow.Options.UseForeColor = true;
            this.gridView2.Appearance.FooterPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.FooterPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.FooterPanel.ForeColor = Color.Black;
            this.gridView2.Appearance.FooterPanel.Options.UseBackColor = true;
            this.gridView2.Appearance.FooterPanel.Options.UseBorderColor = true;
            this.gridView2.Appearance.FooterPanel.Options.UseForeColor = true;
            this.gridView2.Appearance.GroupButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView2.Appearance.GroupButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView2.Appearance.GroupButton.Options.UseBackColor = true;
            this.gridView2.Appearance.GroupButton.Options.UseBorderColor = true;
            this.gridView2.Appearance.GroupFooter.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.GroupFooter.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.GroupFooter.ForeColor = Color.Black;
            this.gridView2.Appearance.GroupFooter.Options.UseBackColor = true;
            this.gridView2.Appearance.GroupFooter.Options.UseBorderColor = true;
            this.gridView2.Appearance.GroupFooter.Options.UseForeColor = true;
            this.gridView2.Appearance.GroupPanel.BackColor = Color.FromArgb(0xf6, 0xf2, 0xd5);
            this.gridView2.Appearance.GroupPanel.BackColor2 = Color.White;
            this.gridView2.Appearance.GroupPanel.ForeColor = Color.Black;
            this.gridView2.Appearance.GroupPanel.Options.UseBackColor = true;
            this.gridView2.Appearance.GroupPanel.Options.UseForeColor = true;
            this.gridView2.Appearance.GroupRow.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.GroupRow.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.GroupRow.ForeColor = Color.Black;
            this.gridView2.Appearance.GroupRow.Options.UseBackColor = true;
            this.gridView2.Appearance.GroupRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.GroupRow.Options.UseForeColor = true;
            this.gridView2.Appearance.HeaderPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.HeaderPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.HeaderPanel.ForeColor = Color.Black;
            this.gridView2.Appearance.HeaderPanel.Options.UseBackColor = true;
            this.gridView2.Appearance.HeaderPanel.Options.UseBorderColor = true;
            this.gridView2.Appearance.HeaderPanel.Options.UseForeColor = true;
            this.gridView2.Appearance.HideSelectionRow.BackColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView2.Appearance.HideSelectionRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView2.Appearance.HideSelectionRow.ForeColor = Color.Black;
            this.gridView2.Appearance.HideSelectionRow.Options.UseBackColor = true;
            this.gridView2.Appearance.HideSelectionRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.HideSelectionRow.Options.UseForeColor = true;
            this.gridView2.Appearance.HorzLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.HorzLine.Options.UseBackColor = true;
            this.gridView2.Appearance.OddRow.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView2.Appearance.OddRow.BorderColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView2.Appearance.OddRow.ForeColor = Color.Black;
            this.gridView2.Appearance.OddRow.Options.UseBackColor = true;
            this.gridView2.Appearance.OddRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.OddRow.Options.UseForeColor = true;
            this.gridView2.Appearance.Preview.BackColor = Color.FromArgb(0xfb, 0xfc, 0xf7);
            this.gridView2.Appearance.Preview.Font = new Font("Verdana", 7.5f);
            this.gridView2.Appearance.Preview.ForeColor = Color.FromArgb(0x94, 0x94, 0x94);
            this.gridView2.Appearance.Preview.Options.UseBackColor = true;
            this.gridView2.Appearance.Preview.Options.UseFont = true;
            this.gridView2.Appearance.Preview.Options.UseForeColor = true;
            this.gridView2.Appearance.Row.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView2.Appearance.Row.ForeColor = Color.Black;
            this.gridView2.Appearance.Row.Options.UseBackColor = true;
            this.gridView2.Appearance.Row.Options.UseForeColor = true;
            this.gridView2.Appearance.RowSeparator.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.RowSeparator.BackColor2 = Color.White;
            this.gridView2.Appearance.RowSeparator.Options.UseBackColor = true;
            this.gridView2.Appearance.SelectedRow.BackColor = Color.FromArgb(0xdd, 0xd7, 0xbc);
            this.gridView2.Appearance.SelectedRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView2.Appearance.SelectedRow.ForeColor = Color.Black;
            this.gridView2.Appearance.SelectedRow.Options.UseBackColor = true;
            this.gridView2.Appearance.SelectedRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.SelectedRow.Options.UseForeColor = true;
            this.gridView2.Appearance.TopNewRow.BackColor = Color.White;
            this.gridView2.Appearance.TopNewRow.Options.UseBackColor = true;
            this.gridView2.Appearance.VertLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.VertLine.Options.UseBackColor = true;
            this.gridView2.Columns.AddRange(new GridColumn[] { this.gridsp_id, this.gridsp_ngay, this.gridsp_sophieu });
            condition2.Appearance.ForeColor = Color.Red;
            condition2.Appearance.Options.UseForeColor = true;
            condition2.Condition = FormatConditionEnum.Between;
            condition2.Value1 = "0";
            condition2.Value2 = "0";
            this.gridView2.FormatConditions.AddRange(new StyleFormatCondition[] { condition2 });
            this.gridView2.GridControl = this.gridsp;
            this.gridView2.Name = "gridView2";
            this.gridView2.OptionsBehavior.AllowAddRows = DefaultBoolean.True;
            this.gridView2.OptionsBehavior.AllowDeleteRows = DefaultBoolean.False;
            this.gridView2.OptionsBehavior.ReadOnly = true;
            this.gridView2.OptionsView.AutoCalcPreviewLineCount = true;
            this.gridView2.OptionsView.EnableAppearanceEvenRow = true;
            this.gridView2.OptionsView.EnableAppearanceOddRow = true;
            this.gridView2.OptionsView.ShowAutoFilterRow = true;
            this.gridView2.OptionsView.ShowFooter = true;
            this.gridView2.OptionsView.ShowGroupPanel = false;
            this.gridView2.FocusedRowChanged += new FocusedRowChangedEventHandler(this.gridView2_FocusedRowChanged);
            this.gridsp_id.Caption = "id";
            this.gridsp_id.FieldName = "id";
            this.gridsp_id.Name = "gridsp_id";
            this.gridsp_ngay.Caption = "Ng\x00e0y";
            this.gridsp_ngay.FieldName = "ngay";
            this.gridsp_ngay.Name = "gridsp_ngay";
            this.gridsp_ngay.OptionsColumn.AllowEdit = false;
            this.gridsp_ngay.Visible = true;
            this.gridsp_ngay.VisibleIndex = 0;
            this.gridsp_sophieu.Caption = "Số phiếu";
            this.gridsp_sophieu.FieldName = "sophieu";
            this.gridsp_sophieu.Name = "gridsp_sophieu";
            this.gridsp_sophieu.OptionsColumn.AllowEdit = false;
            this.gridsp_sophieu.Visible = true;
            this.gridsp_sophieu.VisibleIndex = 1;
            this.repositoryItemTextEdit3.AutoHeight = false;
            this.repositoryItemTextEdit3.Name = "repositoryItemTextEdit3";
            this.repositoryItemTextEdit3.ReadOnly = true;
            this.repositoryItemTextEdit4.AutoHeight = false;
            this.repositoryItemTextEdit4.DisplayFormat.FormatString = "n0";
            this.repositoryItemTextEdit4.DisplayFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit4.EditFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit4.Mask.EditMask = "n0";
            this.repositoryItemTextEdit4.Mask.MaskType = MaskType.Numeric;
            this.repositoryItemTextEdit4.Name = "repositoryItemTextEdit4";
            this.label29.Font = new Font("Tahoma", 10f);
            this.label29.Location = new Point(13, 0x65);
            this.label29.Name = "label29";
            this.label29.Size = new Size(0x57, 0x13);
            this.label29.TabIndex = 2;
            this.label29.Text = "Địa chỉ:";
            this.label29.TextAlign = ContentAlignment.TopRight;
            this.txtdiachi.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtdiachi.Location = new Point(0x60, 0x66);
            this.txtdiachi.Name = "txtdiachi";
            this.txtdiachi.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtdiachi.Size = new Size(0x19d, 20);
            this.txtdiachi.TabIndex = 7;
            this.txtdiachi.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.btnthemduocpham.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnthemduocpham.Location = new Point(0x2ad, 0x18f);
            this.btnthemduocpham.Name = "btnthemduocpham";
            this.btnthemduocpham.Size = new Size(0x17, 20);
            this.btnthemduocpham.TabIndex = 0x2a;
            this.btnthemduocpham.Text = "...";
            this.btnthemduocpham.Click += new EventHandler(this.btnthemduocpham_Click);
            this.label6.Font = new Font("Tahoma", 10f);
            this.label6.Location = new Point(0x1c1, 0x31);
            this.label6.Name = "label6";
            this.label6.Size = new Size(0xa8, 0x13);
            this.label6.TabIndex = 2;
            this.label6.Text = "Ng\x00e0y dự kiến giao h\x00e0ng:";
            this.label6.TextAlign = ContentAlignment.TopRight;
            this.datengaygiao.EditValue = new DateTime(0x7dd, 11, 8, 2, 0x16, 9, 0x297);
            this.datengaygiao.Location = new Point(0x264, 50);
            this.datengaygiao.Name = "datengaygiao";
            this.datengaygiao.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datengaygiao.Properties.DisplayFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengaygiao.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datengaygiao.Properties.EditFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengaygiao.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datengaygiao.Properties.Mask.EditMask = "dd/MM/yyyy HH:mm";
            this.datengaygiao.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datengaygiao.Size = new Size(0x97, 20);
            this.datengaygiao.TabIndex = 2;
            this.datengaygiao.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label9.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label9.Font = new Font("Tahoma", 10f);
            this.label9.Location = new Point(0x20b, 0x65);
            this.label9.Name = "label9";
            this.label9.Size = new Size(0x5e, 0x13);
            this.label9.TabIndex = 2;
            this.label9.Text = "Điện thoại:";
            this.label9.TextAlign = ContentAlignment.TopRight;
            this.txtdienthoai.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.txtdienthoai.Location = new Point(0x264, 100);
            this.txtdienthoai.Name = "txtdienthoai";
            this.txtdienthoai.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtdienthoai.Size = new Size(0x97, 20);
            this.txtdienthoai.TabIndex = 8;
            this.txtdienthoai.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label4.Font = new Font("Tahoma", 10f);
            this.label4.Location = new Point(20, 0x81);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0xaf, 0x13);
            this.label4.TabIndex = 2;
            this.label4.Text = "Phương thức thanh to\x00e1n:";
            this.label4.TextAlign = ContentAlignment.TopRight;
            this.txtptthanhtoan.Location = new Point(190, 0x80);
            this.txtptthanhtoan.Name = "txtptthanhtoan";
            this.txtptthanhtoan.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtptthanhtoan.Size = new Size(0x34, 20);
            this.txtptthanhtoan.TabIndex = 9;
            this.txtptthanhtoan.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label5.Font = new Font("Tahoma", 10f);
            this.label5.Location = new Point(0xd7, 0x81);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0xc1, 0x13);
            this.label5.TabIndex = 2;
            this.label5.Text = "Phương thức giao h\x00e0ng:";
            this.label5.TextAlign = ContentAlignment.TopRight;
            this.txtptgiaohang.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtptgiaohang.Location = new Point(0x193, 0x80);
            this.txtptgiaohang.Name = "txtptgiaohang";
            this.txtptgiaohang.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtptgiaohang.Size = new Size(0x6a, 20);
            this.txtptgiaohang.TabIndex = 10;
            this.txtptgiaohang.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label7.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label7.Font = new Font("Tahoma", 10f);
            this.label7.Location = new Point(0x203, 0x7f);
            this.label7.Name = "label7";
            this.label7.Size = new Size(0x66, 0x13);
            this.label7.TabIndex = 2;
            this.label7.Text = "Điều kiện kh\x00e1c:";
            this.label7.TextAlign = ContentAlignment.TopRight;
            this.txtghichu.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.txtghichu.Location = new Point(0x264, 0x7e);
            this.txtghichu.Name = "txtghichu";
            this.txtghichu.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtghichu.Size = new Size(0x97, 20);
            this.txtghichu.TabIndex = 11;
            this.txtghichu.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.tbnumdongia.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.tbnumdongia.BackColor = Color.White;
            this.tbnumdongia.DecimalBalance = 0;
            this.tbnumdongia.Location = new Point(0x1f8, 0x1a9);
            this.tbnumdongia.Name = "tbnumdongia";
            this.tbnumdongia.ReadOnly = false;
            this.tbnumdongia.Size = new Size(0x4b, 20);
            this.tbnumdongia.SymbolDecimal = ",";
            this.tbnumdongia.SymbolThousand = ".";
            this.tbnumdongia.TabIndex = 0x13;
            this.tbnumdongia.Texts = "0";
            bits = new int[4];
            this.tbnumdongia.Values = new decimal(bits);
            this.tbnumdongia.Validated += new EventHandler(this.tbnumsoluong_Validated);
            this.label11.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label11.Font = new Font("Tahoma", 10f);
            this.label11.Location = new Point(0x1ab, 0x1aa);
            this.label11.Name = "label11";
            this.label11.Size = new Size(80, 0x13);
            this.label11.TabIndex = 2;
            this.label11.Text = "Đơn gi\x00e1:";
            this.label11.TextAlign = ContentAlignment.TopRight;
            this.btnin.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnin.Image = Properties.Resources.imgprint;// (Image)manager.GetObject("btnin.Image");
            this.btnin.Location = new Point(560, 0x1c8);
            this.btnin.Name = "btnin";
            this.btnin.Size = new Size(0x30, 0x17);
            this.btnin.TabIndex = 0x2b;
            this.btnin.Text = " &In";
            this.btnin.Click += new EventHandler(this.btnin_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.btnin);
            base.Controls.Add(this.btnthemduocpham);
            base.Controls.Add(this.groupControl1);
            base.Controls.Add(this.ctrdanhsach_nhacc);
            base.Controls.Add(this.ctrdanhsach_vp);
            base.Controls.Add(this.tbnumsoluong1);
            base.Controls.Add(this.tbnumdongia);
            base.Controls.Add(this.tbnumsoluong);
            base.Controls.Add(this.cbbdonggoi);
            base.Controls.Add(this.datengaygiao);
            base.Controls.Add(this.datengay);
            base.Controls.Add(this.txtnhaccten);
            base.Controls.Add(this.txtdiachi);
            base.Controls.Add(this.txtptgiaohang);
            base.Controls.Add(this.txtptthanhtoan);
            base.Controls.Add(this.txtghichu);
            base.Controls.Add(this.txtdienthoai);
            base.Controls.Add(this.txtnguoidaidien);
            base.Controls.Add(this.txtnhaccma);
            base.Controls.Add(this.txtsophieu);
            base.Controls.Add(this.txtma);
            base.Controls.Add(this.gridds);
            base.Controls.Add(this.btnketthuc);
            base.Controls.Add(this.btnxoa);
            base.Controls.Add(this.btnhuy);
            base.Controls.Add(this.btnboqua);
            base.Controls.Add(this.btnsua);
            base.Controls.Add(this.btnluu);
            base.Controls.Add(this.btnmoi);
            base.Controls.Add(this.btnthem);
            base.Controls.Add(this.txttenhoatchat);
            base.Controls.Add(this.txtten);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.label11);
            base.Controls.Add(this.label14);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.txthangsx);
            base.Controls.Add(this.label5);
            base.Controls.Add(this.txtdvt);
            base.Controls.Add(this.label4);
            base.Controls.Add(this.label7);
            base.Controls.Add(this.label29);
            base.Controls.Add(this.label9);
            base.Controls.Add(this.label10);
            base.Controls.Add(this.label18);
            base.Controls.Add(this.label6);
            base.Controls.Add(this.label25);
            base.Controls.Add(this.label8);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.label16);
            base.Controls.Add(this.lblmaso);
            base.Name = "ucd_phieudathang";
            base.Size = new Size(0x400, 0x1e2);
            base.Load += new EventHandler(this.ucDMSanPham_Load);
            base.ControlRemoved += new ControlEventHandler(this.ucd_phieudathang_ControlRemoved);
            base.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.repositoryItemTextEdit2.EndInit();
            this.txtma.Properties.EndInit();
            this.txtten.Properties.EndInit();
            this.txtdvt.Properties.EndInit();
            this.gridView1.EndInit();
            this.repositoryItemTextEdit1.EndInit();
            this.gridds.EndInit();
            this.txtsophieu.Properties.EndInit();
            this.txtnhaccten.Properties.EndInit();
            this.txttenhoatchat.Properties.EndInit();
            this.txthangsx.Properties.EndInit();
            this.datengay.Properties.VistaTimeProperties.EndInit();
            this.datengay.Properties.EndInit();
            this.txtnguoidaidien.Properties.EndInit();
            this.txtnhaccma.Properties.EndInit();
            this.cbbdonggoi.Properties.EndInit();
            this.groupControl1.EndInit();
            this.groupControl1.ResumeLayout(false);
            this.datetungay.Properties.VistaTimeProperties.EndInit();
            this.datetungay.Properties.EndInit();
            this.datedenngay.Properties.VistaTimeProperties.EndInit();
            this.datedenngay.Properties.EndInit();
            this.gridsp.EndInit();
            this.gridView2.EndInit();
            this.repositoryItemTextEdit3.EndInit();
            this.repositoryItemTextEdit4.EndInit();
            this.txtdiachi.Properties.EndInit();
            this.datengaygiao.Properties.VistaTimeProperties.EndInit();
            this.datengaygiao.Properties.EndInit();
            this.txtdienthoai.Properties.EndInit();
            this.txtptthanhtoan.Properties.EndInit();
            this.txtptgiaohang.Properties.EndInit();
            this.txtghichu.Properties.EndInit();
            base.ResumeLayout(false);
        }

        private void numthue_Enter(object sender, EventArgs e)
        {
        }

        private void tbnumslsang_Validated(object sender, EventArgs e)
        {
            try
            {
            }
            catch
            {
            }
        }

        private void tbnumsoluong_Validated(object sender, EventArgs e)
        {
            try
            {
            }
            catch
            {
            }
        }

        private void tbnumsoluong1_Validated(object sender, EventArgs e)
        {
            try
            {
                decimal num = 1M;
                try
                {
                    DataTable dataSource = (DataTable) this.cbbdonggoi.Properties.DataSource;
                    num = decimal.Parse(dataSource.Select("id=" + this.cbbdonggoi.EditValue.ToString())[0]["soluong"].ToString());
                }
                catch
                {
                }
                this.tbnumsoluong.Values = this.tbnumsoluong1.Values * num;
            }
            catch
            {
            }
        }

        private void txtma_Validated(object sender, EventArgs e)
        {
            try
            {
                DataRow[] rowArray = this.ctrdanhsach_vp.SetDataSource.Select("ma='" + this.txtma.Text + "'");
                this.f_SetControl_dmsanpham(long.Parse(rowArray[0]["id"].ToString()));
                if (rowArray.Length > 0)
                {
                    this.ctrdanhsach_vp.Visible = false;
                }
            }
            catch
            {
            }
        }

        private void txtnhaccten_Enter(object sender, EventArgs e)
        {
            this.ctrdanhsach_nhacc.Width = (this.txtnhaccten.Location.X + this.txtnhaccten.Width) - this.txtnhaccma.Location.X;
            this.ctrdanhsach_nhacc.DanhSachCotHienThi_kt = string.Concat(new object[] { this.txtnhaccten.Location.X - this.txtnhaccma.Location.X, ",", ((this.ctrdanhsach_nhacc.Width - 0x9b) - this.txtnhaccten.Location.X) + this.txtnhaccma.Location.X, ",", 150 });
            this.ctrdanhsach_nhacc.Location = new Point(this.txtnhaccma.Location.X, (this.txtnhaccma.Location.Y + this.txtnhaccma.Height) + 1);
            this.ctrdanhsach_nhacc.BringToFront();
        }

        private void txtnhaccten_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down))
            {
                this.ctrdanhsach_nhacc.Visible = true;
                this.ctrdanhsach_nhacc.Focus();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                this.ctrdanhsach_nhacc.Visible = false;
            }
            else
            {
                this.ctrdanhsach_nhacc.Visible = false;
                this.ucDMSanPham_KeyDown(sender, e);
            }
        }

        private void txtnhaccten_TextChanged(object sender, EventArgs e)
        {
            if (this.txtnhaccten.IsEditorActive)
            {
                this.ctrdanhsach_nhacc.Visible = true;
                this.ctrdanhsach_nhacc.Locdulieu(this.txtnhaccten.Text);
            }
        }

        private void txtten_Enter(object sender, EventArgs e)
        {
            this.ctrdanhsach_vp.Width = (this.txttenhoatchat.Location.X + this.txttenhoatchat.Width) - this.txtma.Location.X;
            this.ctrdanhsach_vp.Height = 90;
            this.ctrdanhsach_vp.DanhSachCotHienThi_kt = string.Concat(new object[] { this.txtten.Location.X - this.txtma.Location.X, ",", ((this.ctrdanhsach_vp.Width - 0x23) - this.txtten.Location.X) + this.txtma.Location.X, ",", 30 });
            this.ctrdanhsach_vp.Location = new Point(this.txtma.Location.X, (this.txtma.Location.Y - this.ctrdanhsach_vp.Height) - 1);
            this.ctrdanhsach_vp.BringToFront();
        }

        private void txtten_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down))
            {
                if (this.ctrdanhsach_vp.Visible)
                {
                    this.ctrdanhsach_vp.Focus();
                }
            }
            else if (e.KeyCode == Keys.Escape)
            {
                this.ctrdanhsach_vp.Visible = false;
            }
            else
            {
                this.ctrdanhsach_vp.Visible = false;
                this.ucDMSanPham_KeyDown(sender, e);
            }
        }

        private void txtten_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (this.txtten.IsEditorActive)
                {
                    this.ctrdanhsach_vp.Visible = true;
                    this.ctrdanhsach_vp.Locdulieu(this.txtten.Text);
                }
            }
            catch
            {
            }
        }

        private void txtten_Validated(object sender, EventArgs e)
        {
            try
            {
            }
            catch
            {
            }
        }

        private void ucd_phieudathang_ControlRemoved(object sender, ControlEventArgs e)
        {
            if (e.Control.Name == "ucd_dmduocpham")
            {
                this.f_Loaddata_dmvp();
            }
        }

        private void ucDMSanPham_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                SendKeys.Send("{Tab}");
            }
            else if (e.KeyCode == Keys.F2)
            {
                if (this.btnmoi.Enabled)
                {
                    this.btnmoi_Click_1(null, null);
                }
            }
            else if (e.KeyCode == Keys.F1)
            {
                if (this.btnthem.Enabled)
                {
                    this.btnmoi_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F3)
            {
                if (this.btnsua.Enabled)
                {
                    this.btnsua_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F4)
            {
                if (this.btnboqua.Enabled)
                {
                    this.btnboqua_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F5)
            {
                if (this.btnluu.Enabled)
                {
                    this.btnluu_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F7)
            {
                if (this.btnhuy.Enabled)
                {
                    this.btnxoa_Click(null, null);
                }
            }
            else if ((e.KeyCode == Keys.F12) && this.btnketthuc.Enabled)
            {
                this.btnketthuc_Click(null, null);
            }
        }

        private void ucDMSanPham_Load(object sender, EventArgs e)
        {
            this._phieudathang = new DPhieuDatHang(this._xuli.pConFigData);
            this.f_Loaddata_dmvp();
            this.f_Loaddata_dmnhacungcap();
            this.f_setcontrol_phieudathang(this._iDPhieuDatHang);
            this.f_loaddata_phieudathangct(long.Parse(this.txtsophieu.Tag.ToString()));
            this.btnboqua_Click(null, null);
            this.f_loadinfo_chidinhchitiet(0);
            this.datetungay.EditValue = this.datedenngay.EditValue = DateTime.Now;
        }
    }
}

